﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;

namespace mozhi.smarterp.Finance.Finances.Services.EndPeriodProcess
{
    public class EndPeriodProcessorFacotry
    {
        public static IEndPeriodProcessor Instance(EndPeriodProcessItem item, int period, IServiceProvider serviceProvider, Dictionary<Guid, decimal> exchangeRates = null)
        {
            IEndPeriodProcessor result = null;

            if (item.Index == 1)     //结转销售成本
                return new TransferCostEndPeriodProcessor(item, period, serviceProvider);
            if (item.Index == 2)       //计提折旧
                return new DepreciationEndPeriodProcessor(item, period, serviceProvider);
            if (item.Index == 3)     //摊销长期待摊费用
                return new AmortizeExpensesEndPeriodProcessor(item, period, serviceProvider);
            if (item.Index == 4)     //期末调汇
                return new ExchangeAdjustmentEndPeriodProcessor(item, period, exchangeRates, serviceProvider);
            if (item.Index == 5)     //结转未交增值税
                return new TransferVATEndPeriodProcessor(item, period, serviceProvider);
            if (item.Index == 6)     //计提所得税
                result = new AccrualIncomeTaxEndPeriodProcessor(item, period, serviceProvider);
            else if (item.Index == 7) //结转损益
                return new ProfitLossEndPeriodProcessor(item, period, serviceProvider);
            else if (item.Index == 8)//结转未分配利润
                return new UndistributedProfitEndPeriodProcessor(item , period , serviceProvider);


            return result;
        }
    }
}
